<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="./Promise.js"></script>
    <script>
        // var p = new Promise((resolve,reject)=>{
        //     if(Date.now() %2 === 0){
        //         resolve('请求数据成功')
        //     }else{
        //         reject('请求数据失败')
        //     }
        // })
        // p.then(
        // )
        // .then(
        //     value=>{
        //        console.log(value);
        //     }
        // )
        const p1 = Promise.resolveDelay(3,7000)
        const p2 = Promise.resolve(5)
        const p3 = Promise.reject(6)
        console.log(p1,p2);
        // Promise.all([p1, p2, p3]).then(
        //     value =>{
        //         console.log(value);
        //     },
        //     reason =>{
        //         console.log(reason)
        //     }
        // )
        Promise.race([p1,p3]).then(
            value =>{
                console.log(value)
            },
            reason =>{
                console.log(reason)
            }
        )
    </script>
</body>
</html>